<?php
/******************************************************
------------------Configuration-File------------
Edit the following variables to match your needs.
THESE VARIABLES ARE TO MAKE THINGS EASY TO CHANGE ON YOUR SITE WITHOUT HAVING TO CHANGE ON EVERY PAGE
******************************************************/
//////////////////////////////////////////////////////////
$linker = mysqli_connect("localhost", "root", "", "test");
////////////////////////////////////////////////////////////////////
$admin='admin'; //SHOULD MATCH LOGGED IN ADMIN USERNAME,, DATABASE ONLY ALLOWS ONE OF THIS VALUE//
///ADD SALT OR ADMIN LOGIN KEY HERE IF NEEDED///
$design = 'default';
/*********************************/
///THIS SETS THE TIME DATE TIMEZONE FOR YOUR AREA//
///EVEN THOUGH THE DATATIME FUNCTION ONLY WORKS WITH THIS LINE,,YOU WILL HAVE TO ADD IT INTO CLASSES AND FUNCTIONS SEPARATE///
date_default_timezone_set('America/Chicago');
/******************************************************
----------------------SESSIONS Initialization----------
******************************************************/
//THIS FILE IS A FAST LINK THAT CONTAINS THE SESSIONS AND COOKIES CONTROLLER,PLEASE DONT ALTER THIS FILE//
//THIS SCRIPT MUST REMAIN AT BOTTOM OF THE CONFIG FILE AND INCLUDED INTO NEEDED PAGES AS LONG AS IT IS FIRST//
session_start();
header('Content-type: text/html;charset=UTF-8');
if(!isset($_SESSION['username']) and isset($_COOKIE['username'], $_COOKIE['password']))
{
  $cnn = mysqli_query($linker, 'select password,id from users where username="'.mysql_real_escape_string($_COOKIE['username']).'"');
  $dn_cnn = mysqli_fetch_array($cnn);
  if(md5($dn_cnn['password'])==$_COOKIE['password'] and mysqli_num_rows($cnn)>0)
  {
    $_SESSION['username'] = $_COOKIE['username'];
    $_SESSION['userid'] = $dn_cnn['id'];
  }
}
?>
